home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / dev / c / AmiVoGL_MDEV.lha / src / move.c < prev    next >
C/C++ Source or Header  |  1994-04-12  |  4KB  |  238 lines

  1. #include "vogl.h"
  2.  
  3. /*
  4.  * move
  5.  *
  6.  * Move the logical graphics position to the world coordinates x, y, z.
  7.  *
  8.  */
  9. void move(
  10.   Coord x,
  11.   Coord y,
  12.   Coord z)
  13. {
  14. Token    *p;
  15.  
  16. if (!vdevice.initialised) 
  17. verror("move: vogl not initialised");
  18.  
  19. vdevice.cpW[V_X] = x;
  20. vdevice.cpW[V_Y] = y;
  21. vdevice.cpW[V_Z] = z;
  22.  
  23. vdevice.cpVvalid = 0;
  24.  
  25. if (vdevice.inobject) {
  26.     p = newtokens(4);
  27.  
  28.     p[0].i = MOVE;
  29.     p[1].f = x;
  30.     p[2].f = y;
  31.     p[3].f = z;
  32.  
  33.     return;
  34.     }
  35.  
  36. if (vdevice.clipoff) {        /* update device coords as well */
  37.     multvector(vdevice.cpWtrans, vdevice.cpW, vdevice.transmat->m);
  38.     vdevice.cpVx = WtoVx(vdevice.cpWtrans);
  39.     vdevice.cpVy = WtoVy(vdevice.cpWtrans);
  40.     }
  41. }
  42.  
  43. /* ------------------------------------------------------------------------ */
  44.  
  45. /*
  46.  * moves
  47.  *
  48.  * Move the logical graphics position to the world coordinates x, y, z.
  49.  * expressed as a short integer data type.
  50.  *
  51.  */
  52. void moves(
  53.   Scoord x,
  54.   Scoord y,
  55.   Scoord z)
  56. {
  57. move((Coord)x, (Coord)y, (Coord)z);
  58. }
  59.  
  60. /* ------------------------------------------------------------------------ */
  61.  
  62.  
  63. /*
  64.  * movei
  65.  *
  66.  * Move the logical graphics position to the world coordinates x, y, z.
  67.  * expressed as an integer data type.
  68.  *
  69.  */
  70. void movei(
  71.   Icoord x,
  72.   Icoord y,
  73.   Icoord z)
  74. {
  75. move((Coord)x, (Coord)y, (Coord)z);
  76. }
  77.  
  78. /* ------------------------------------------------------------------------ */
  79.  
  80.  
  81. /*
  82.  * move2
  83.  *
  84.  * Move the logical graphics position to the world coords x, y, 0.0
  85.  * (I.e. a 2D move is defined as a 3D move with the Z-coord set to zero)
  86.  *
  87.  */
  88. void move2(
  89.   Coord x,
  90.   Coord y)
  91. {
  92. if (!vdevice.initialised) 
  93. verror("move2: vogl not initialised");
  94.  
  95. move(x, y, 0.0);
  96. }
  97.  
  98. /* ------------------------------------------------------------------------ */
  99.  
  100. /*
  101.  * move2s
  102.  *
  103.  * Move the logical graphics position to the world coordinates x, y.
  104.  * expressed as a short integer data type.
  105.  *
  106.  */
  107. void move2s(
  108.   Scoord x,
  109.   Scoord y)
  110. {
  111. move2((Coord)x, (Coord)y);
  112. }
  113.  
  114. /* ------------------------------------------------------------------------ */
  115.  
  116.  
  117. /*
  118.  * move2i
  119.  *
  120.  * Move the logical graphics position to the world coordinates x, y.
  121.  * expressed as an integer data type.
  122.  *
  123.  */
  124. void move2i(
  125.   Icoord x,
  126.   Icoord y)
  127. {
  128. move2((Coord)x, (Coord)y);
  129. }
  130.  
  131. /* ------------------------------------------------------------------------ */
  132.  
  133.  
  134. /*
  135.  * rmv
  136.  *
  137.  * move the logical graphics position from the current world 
  138.  * coordinates by dx, dy, dz 
  139.  *
  140.  */
  141. void rmv(
  142.   Coord dx,
  143.   Coord dy,
  144.   Coord dz)
  145. {
  146. if (!vdevice.initialised) 
  147. verror("rmv: vogl not initialised");
  148.  
  149. move((vdevice.cpW[V_X] + dx), (vdevice.cpW[V_Y] + dy), (vdevice.cpW[V_Z] + dz));
  150. }
  151.  
  152. /* ------------------------------------------------------------------------ */
  153.  
  154. /*
  155.  * rmvs
  156.  *
  157.  * move the logical graphics position from the current world 
  158.  * coordinates by dx, dy, dz expressed as a short integer data type.
  159.  *
  160.  */
  161. void rmvs(
  162.   Scoord dx,
  163.   Scoord dy,
  164.   Scoord dz)
  165. {
  166. rmv((Coord)dx, (Coord)dy, (Coord)dz);
  167. }
  168.  
  169. /* ------------------------------------------------------------------------ */
  170.  
  171. /*
  172.  * rmvi
  173.  *
  174.  * move the logical graphics position from the current world 
  175.  * coordinates by dx, dy, dz expressed as an integer data type.
  176.  *
  177.  */
  178. void rmvi(
  179.   Icoord dx,
  180.   Icoord dy,
  181.   Icoord dz)
  182. {
  183. rmv((Coord)dx, (Coord)dy, (Coord)dz);
  184. }
  185.  
  186. /* ------------------------------------------------------------------------ */
  187.  
  188. /*
  189.  * rmv2
  190.  *
  191.  * Move Relative in 2D.
  192.  *
  193.  */
  194. void rmv2(
  195.   float dx,
  196.   float dy)
  197. {
  198. if (!vdevice.initialised) 
  199. verror("rmv2: vogl not initialised");
  200.  
  201. move((vdevice.cpW[V_X] + dx), (vdevice.cpW[V_Y] + dy), 0.0);
  202. }
  203.  
  204. /* ------------------------------------------------------------------------ */
  205.  
  206. /*
  207.  * rmv2s
  208.  *
  209.  * move the logical graphics position from the current world 
  210.  * coordinates by dx, dy expressed as a short integer data type.
  211.  *
  212.  */
  213. void rmv2s(
  214.   Scoord dx,
  215.   Scoord dy)
  216. {
  217. rmv2((Coord)dx, (Coord)dy);
  218. }
  219.  
  220. /* ------------------------------------------------------------------------ */
  221.  
  222. /*
  223.  * rmv2i
  224.  *
  225.  * move the logical graphics position from the current world 
  226.  * coordinates by dx, dy expressed as an integer data type.
  227.  *
  228.  */
  229. void rmv2i(
  230.   Icoord dx,
  231.   Icoord dy)
  232. {
  233. rmv2((Coord)dx, (Coord)dy);
  234. }
  235.  
  236. /* ------------------------------------------------------------------------ */
  237.  
  238.